#!/bin/bash
#SBATCH --job-name=MSE6701
#SBATCH --partition=64c512g
#SBATCH -N 1
#SBATCH --ntasks-per-node=4
#SBATCH --output=%j.out
#SBATCH --error=%j.err

. ../../0-tools/environment

module load intel-oneapi-compilers/2021.4.0
module load intel-oneapi-mpi/2021.4.0
module load intel-oneapi-mkl/2021.4.0

ulimit -s unlimited

# Step 1: SCF calculation (uniform k-mesh)
rm -rf INCAR KPOINTS
ln -s INCAR.1 INCAR
ln -s KPOINTS.1 KPOINTS

mpirun ${VASP}

# Step 2: NSCF calculation (DOS, uniform but denser)
rm -rf INCAR KPOINTS
ln -s INCAR.2 INCAR
ln -s KPOINTS.2 KPOINTS

mpirun ${VASP}

mv DOSCAR DOSCAR.dos

# Step 3: NSCF calculation (band structure, line mode)
rm -rf INCAR KPOINTS
ln -s INCAR.3 INCAR
ln -s KPOINTS.3 KPOINTS

mpirun ${VASP}

# clean up
rm -rf CHG CONTCAR OSZICAR PBS.batch PCDAT XDATCAR
#
# Now the DOSCAR does contain the DOS from step 2
mv DOSCAR.dos DOSCAR
